#!/usr/bin/env bash
#
# Replaces certain "uncontrollable" properties with fixed values
# This allows for comparison of documents without expecting these
# properties to be equal
#
set -euf -o pipefail

jq "del(.[].elements[]?.before[]?.result.duration)" | \

jq "del(.[].elements[]?.before[]?.result.duration)" | \
jq ".[].elements[]?.before[]?.result.error_message = \"some before hook error\"" | \
jq ".[].elements[]?.before[]?.match.location = \"some_before_hook.xyz\"" |

jq "del(.[].elements[]?.steps[]?.result.duration)" | \
jq ".[].elements[]?.steps[]?.result.error_message = \"some stepdef error\"" | \
jq ".[].elements[]?.steps[]?.match.location = \"some_stepdef.xyz\"" | \

jq "del(.[].elements[]?.after[]?.result.duration)" | \
jq ".[].elements[]?.after[]?.result.error_message = \"some after hook error\"" | \
jq ".[].elements[]?.after[]?.match.location = \"some_after_hook.xyz\"" | \

jq